from rest_framework import serializers
from .models import *
from .views import *


# 用户序列化器
class UserSer(serializers.ModelSerializer):
    class Meta:
        model = UserModel
        fields = ['id', 'username', 'school_id', 'grade_id', 'position_id', 'create_date']
        read_only_fields = ['id']


# 用户详情
class UserDetailedSer(serializers.ModelSerializer):
    class Meta:
        model = UserDetailedModel
        fields = "__all__"


# 学校序列化器
class SchoolSer(serializers.ModelSerializer):
    class Meta:
        model = SchoolModel
        fields = "__all__"


# 班级序列化器
class GradeSer(serializers.ModelSerializer):
    class Meta:
        model = GradeMode
        fields = "__all__"


# 教师班级序列化器
class TeacherGradeSer(serializers.ModelSerializer):
    class Meta:
        model = TeacherGradeModel
        fields = "__all__"


# 问候语序列化器
class GreetingSer(serializers.ModelSerializer):

    class Meta:
        model = GreetingsModel
        fields = '__all__'